package annotation;

import annotation.base.UseCase;
import utils.Log;

import java.lang.reflect.Method;
import java.util.List;

/**
 * Created by shane on 2018/5/27.
 */
public class UseCaseTracker {

    public static void trackUseCases(List<Integer> useCases, Class<?> cl) {
        for (Method m : cl.getDeclaredMethods()) {
            UseCase uc = m.getAnnotation(UseCase.class);
            if (uc != null) {
                Log.vn("Found Use Case:" + uc.id() + " " + uc.description());

                useCases.remove(new Integer(uc.id()));
            }
        }

        for (int i : useCases) {
            Log.vn("Warning: Missing use case-" + i);
        }
    }
}
